﻿namespace scheduler.Model
{
    public class TodoInfo
    {
        public string File { get; set; }
        public string Title { get; set; }
        public string[] PathTitles { get; set; }
        public string Due { get; set; }
        public string Description { get; set; }

        private string _pathTitlesStr
        {
            get { return string.Join("\n", PathTitles); }
        }

        public bool Equals(TodoInfo other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.File, File) && Equals(other._pathTitlesStr, _pathTitlesStr);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (TodoInfo)) return false;
            return Equals((TodoInfo) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((File != null ? File.GetHashCode() : 0)*397) ^ (_pathTitlesStr.GetHashCode());
            }
        }
    }
}